.class public final Lcom/estrongs/fs/impl/usb/fs/ntfs/b;
.super Ljava/lang/Object;
.source "CompressedDataRun.java"

# interfaces
.implements Lcom/estrongs/fs/impl/usb/fs/ntfs/d;


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;
    }
.end annotation


# instance fields
.field private final a:Lcom/estrongs/fs/impl/usb/fs/ntfs/c;

.field private final b:I


# direct methods
.method static constructor <clinit>()V
    .locals 0

    return-void
.end method

.method public constructor <init>(Lcom/estrongs/fs/impl/usb/fs/ntfs/c;I)V
    .locals 0

    .line 1
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 2
    iput-object p1, p0, Lcom/estrongs/fs/impl/usb/fs/ntfs/b;->a:Lcom/estrongs/fs/impl/usb/fs/ntfs/c;

    .line 3
    iput p2, p0, Lcom/estrongs/fs/impl/usb/fs/ntfs/b;->b:I

    return-void
.end method

.method private static a(Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;)I
    .locals 14

    const/4 v0, 0x0

    .line 29
    invoke-static {p0, v0}, Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;->b(Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;I)I

    move-result v1

    and-int/lit16 v2, v1, 0xfff

    if-nez v1, :cond_0

    return v0

    :cond_0
    const v3, 0x8000

    and-int/2addr v1, v3

    const/16 v3, 0xfff

    const/4 v4, 0x3

    if-nez v1, :cond_1

    add-int/lit8 v1, v2, 0x1

    .line 30
    invoke-static {p1, p0, v4, v0, v1}, Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;->a(Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;III)V

    sub-int/2addr v3, v2

    .line 31
    invoke-static {p1, v1, v3}, Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;->a(Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;II)V

    add-int/2addr v2, v4

    return v2

    :cond_1
    const/4 v1, 0x2

    const/4 v5, 0x0

    :goto_0
    add-int/lit8 v6, v2, 0x3

    if-ge v1, v6, :cond_5

    const/16 v7, 0x1000

    if-ge v5, v7, :cond_5

    add-int/lit8 v6, v1, 0x1

    .line 32
    invoke-static {p0, v1}, Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;->c(Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;I)B

    move-result v1

    const/4 v8, 0x0

    move v13, v5

    move v5, v1

    move v1, v6

    move v6, v13

    :goto_1
    const/16 v9, 0x8

    if-ge v8, v9, :cond_4

    if-ge v6, v7, :cond_4

    and-int/lit8 v9, v5, 0x1

    if-eqz v9, :cond_3

    add-int/lit8 v9, v6, -0x1

    const/16 v10, 0xc

    const/16 v11, 0xfff

    :goto_2
    const/16 v12, 0x10

    if-lt v9, v12, :cond_2

    add-int/lit8 v10, v10, -0x1

    shr-int/lit8 v11, v11, 0x1

    shr-int/lit8 v9, v9, 0x1

    goto :goto_2

    .line 33
    :cond_2
    invoke-static {p0, v1}, Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;->b(Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;I)I

    move-result v9

    add-int/lit8 v1, v1, 0x2

    shr-int v10, v9, v10

    rsub-int/lit8 v10, v10, -0x1

    and-int/2addr v9, v11

    add-int/2addr v9, v4

    rsub-int v11, v6, 0x1000

    .line 34
    invoke-static {v9, v11}, Ljava/lang/Math;->min(II)I

    move-result v9

    add-int/2addr v10, v6

    .line 35
    invoke-static {p1, p1, v10, v6, v9}, Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;->a(Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;III)V

    add-int/2addr v6, v9

    goto :goto_3

    :cond_3
    add-int/lit8 v9, v6, 0x1

    add-int/lit8 v10, v1, 0x1

    .line 36
    invoke-static {p0, v1}, Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;->c(Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;I)B

    move-result v1

    invoke-static {p1, v6, v1}, Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;->a(Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;IB)V

    move v6, v9

    move v1, v10

    :goto_3
    shr-int/lit8 v5, v5, 0x1

    int-to-byte v5, v5

    add-int/lit8 v8, v8, 0x1

    goto :goto_1

    :cond_4
    move v5, v6

    goto :goto_0

    :cond_5
    return v6
.end method

.method private static a([B[B)V
    .locals 5
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 22
    new-instance v0, Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;

    const/4 v1, 0x0

    invoke-direct {v0, p0, v1}, Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;-><init>([BLcom/estrongs/fs/impl/usb/fs/ntfs/b$a;)V

    .line 23
    new-instance p0, Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;

    invoke-direct {p0, p1, v1}, Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;-><init>([BLcom/estrongs/fs/impl/usb/fs/ntfs/b$a;)V

    const/4 v1, 0x0

    const/4 v2, 0x0

    :goto_0
    mul-int/lit16 v3, v2, 0x1000

    .line 24
    array-length v4, p1

    if-ge v3, v4, :cond_1

    .line 25
    invoke-static {v0, p0}, Lcom/estrongs/fs/impl/usb/fs/ntfs/b;->a(Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;)I

    move-result v3

    if-nez v3, :cond_0

    .line 26
    array-length p1, p1

    invoke-static {p0}, Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;->a(Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;)I

    move-result v0

    sub-int/2addr p1, v0

    invoke-static {p0, v1, p1}, Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;->a(Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;II)V

    goto :goto_1

    .line 27
    :cond_0
    invoke-static {v0}, Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;->a(Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;)I

    move-result v4

    add-int/2addr v4, v3

    invoke-static {v0, v4}, Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;->a(Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;I)I

    .line 28
    invoke-static {p0}, Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;->a(Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;)I

    move-result v3

    add-int/lit16 v3, v3, 0x1000

    invoke-static {p0, v3}, Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;->a(Lcom/estrongs/fs/impl/usb/fs/ntfs/b$b;I)I

    add-int/lit8 v2, v2, 0x1

    goto :goto_0

    :cond_1
    :goto_1
    return-void
.end method


# virtual methods
.method public a(J[BIIILcom/estrongs/fs/impl/usb/fs/ntfs/t;)I
    .locals 17
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    move-object/from16 v0, p0

    move-wide/from16 v2, p1

    move-object/from16 v4, p3

    .line 1
    iget-object v1, v0, Lcom/estrongs/fs/impl/usb/fs/ntfs/b;->a:Lcom/estrongs/fs/impl/usb/fs/ntfs/c;

    invoke-virtual {v1}, Lcom/estrongs/fs/impl/usb/fs/ntfs/c;->b()J

    move-result-wide v6

    .line 2
    invoke-virtual/range {p0 .. p0}, Lcom/estrongs/fs/impl/usb/fs/ntfs/b;->b()J

    move-result-wide v8

    move/from16 v1, p5

    int-to-long v10, v1

    add-long/2addr v10, v2

    const-wide/16 v12, 0x1

    sub-long/2addr v10, v12

    cmp-long v5, v2, v8

    if-gtz v5, :cond_5

    cmp-long v5, v6, v10

    if-lez v5, :cond_0

    goto/16 :goto_0

    .line 3
    :cond_0
    invoke-static {v6, v7, v2, v3}, Ljava/lang/Math;->max(JJ)J

    move-result-wide v14

    .line 4
    invoke-static {v8, v9, v10, v11}, Ljava/lang/Math;->min(JJ)J

    move-result-wide v8

    sub-long/2addr v8, v14

    add-long/2addr v8, v12

    long-to-int v13, v8

    .line 5
    iget-object v5, v0, Lcom/estrongs/fs/impl/usb/fs/ntfs/b;->a:Lcom/estrongs/fs/impl/usb/fs/ntfs/c;

    invoke-virtual {v5}, Lcom/estrongs/fs/impl/usb/fs/ntfs/c;->d()I

    move-result v12

    .line 6
    iget v5, v0, Lcom/estrongs/fs/impl/usb/fs/ntfs/b;->b:I

    if-ne v12, v5, :cond_1

    .line 7
    iget-object v1, v0, Lcom/estrongs/fs/impl/usb/fs/ntfs/b;->a:Lcom/estrongs/fs/impl/usb/fs/ntfs/c;

    move-wide/from16 v2, p1

    move-object/from16 v4, p3

    move/from16 v5, p4

    move v6, v12

    move/from16 v7, p6

    move-object/from16 v8, p7

    invoke-virtual/range {v1 .. v8}, Lcom/estrongs/fs/impl/usb/fs/ntfs/c;->a(J[BIIILcom/estrongs/fs/impl/usb/fs/ntfs/t;)I

    move-result v1

    return v1

    :cond_1
    int-to-long v8, v5

    .line 8
    rem-long v8, v14, v8

    long-to-int v11, v8

    mul-int v5, v5, p6

    .line 9
    new-array v10, v5, [B

    .line 10
    iget-object v5, v0, Lcom/estrongs/fs/impl/usb/fs/ntfs/b;->a:Lcom/estrongs/fs/impl/usb/fs/ntfs/c;

    const/4 v9, 0x0

    move-object v8, v10

    move-object v1, v10

    move v10, v12

    move/from16 v16, v11

    move/from16 v11, p6

    move v4, v12

    move-object/from16 v12, p7

    invoke-virtual/range {v5 .. v12}, Lcom/estrongs/fs/impl/usb/fs/ntfs/c;->a(J[BIIILcom/estrongs/fs/impl/usb/fs/ntfs/t;)I

    move-result v5

    if-ne v5, v4, :cond_4

    .line 11
    iget v4, v0, Lcom/estrongs/fs/impl/usb/fs/ntfs/b;->b:I

    mul-int v4, v4, p6

    new-array v5, v4, [B

    .line 12
    invoke-static {v1, v5}, Lcom/estrongs/fs/impl/usb/fs/ntfs/b;->a([B[B)V

    mul-int v11, v16, p6

    sub-long/2addr v14, v2

    long-to-int v1, v14

    mul-int v1, v1, p6

    add-int v1, p4, v1

    mul-int v2, v13, p6

    add-int v3, v1, v2

    move-object/from16 v6, p3

    .line 13
    array-length v7, v6

    const/4 v8, 0x2

    const/4 v9, 0x1

    const/4 v10, 0x3

    if-gt v3, v7, :cond_3

    add-int v3, v11, v2

    if-gt v3, v4, :cond_2

    .line 14
    invoke-static {v5, v11, v6, v1, v2}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V

    return v13

    .line 15
    :cond_2
    new-instance v1, Ljava/lang/ArrayIndexOutOfBoundsException;

    new-array v3, v10, [Ljava/lang/Object;

    .line 16
    invoke-static {v11}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v5

    const/4 v6, 0x0

    aput-object v5, v3, v6

    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    aput-object v2, v3, v9

    .line 17
    invoke-static {v4}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    aput-object v2, v3, v8

    const-string v2, "Copy source %d length %d is too big for source %d"

    .line 18
    invoke-static {v2, v3}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v2

    invoke-direct {v1, v2}, Ljava/lang/ArrayIndexOutOfBoundsException;-><init>(Ljava/lang/String;)V

    throw v1

    .line 19
    :cond_3
    new-instance v3, Ljava/lang/ArrayIndexOutOfBoundsException;

    new-array v4, v10, [Ljava/lang/Object;

    .line 20
    invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v1

    const/4 v5, 0x0

    aput-object v1, v4, v5

    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v1

    aput-object v1, v4, v9

    array-length v1, v6

    invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v1

    aput-object v1, v4, v8

    const-string v1, "Copy dest %d length %d is too big for destination %d"

    invoke-static {v1, v4}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v1

    invoke-direct {v3, v1}, Ljava/lang/ArrayIndexOutOfBoundsException;-><init>(Ljava/lang/String;)V

    throw v3

    :cond_4
    move v1, v4

    .line 21
    new-instance v2, Ljava/io/IOException;

    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    const-string v4, "Needed "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v3, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    const-string v1, " clusters but could only read "

    invoke-virtual {v3, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v3, v5}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-direct {v2, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw v2

    :cond_5
    :goto_0
    const/4 v1, 0x0

    return v1
.end method

.method public a()J
    .locals 2

    .line 37
    iget-object v0, p0, Lcom/estrongs/fs/impl/usb/fs/ntfs/b;->a:Lcom/estrongs/fs/impl/usb/fs/ntfs/c;

    invoke-virtual {v0}, Lcom/estrongs/fs/impl/usb/fs/ntfs/c;->b()J

    move-result-wide v0

    return-wide v0
.end method

.method public b()J
    .locals 4

    .line 1
    invoke-virtual {p0}, Lcom/estrongs/fs/impl/usb/fs/ntfs/b;->a()J

    move-result-wide v0

    invoke-virtual {p0}, Lcom/estrongs/fs/impl/usb/fs/ntfs/b;->c()I

    move-result v2

    int-to-long v2, v2

    add-long/2addr v0, v2

    const-wide/16 v2, 0x1

    sub-long/2addr v0, v2

    return-wide v0
.end method

.method public c()I
    .locals 1

    .line 1
    iget v0, p0, Lcom/estrongs/fs/impl/usb/fs/ntfs/b;->b:I

    return v0
.end method

.method public toString()Ljava/lang/String;
    .locals 3

    const/4 v0, 0x2

    new-array v0, v0, [Ljava/lang/Object;

    .line 1
    invoke-virtual {p0}, Lcom/estrongs/fs/impl/usb/fs/ntfs/b;->a()J

    move-result-wide v1

    invoke-static {v1, v2}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v1

    const/4 v2, 0x0

    aput-object v1, v0, v2

    invoke-virtual {p0}, Lcom/estrongs/fs/impl/usb/fs/ntfs/b;->b()J

    move-result-wide v1

    invoke-static {v1, v2}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v1

    const/4 v2, 0x1

    aput-object v1, v0, v2

    const-string v1, "[compressed-run vcn:%d-%d]"

    invoke-static {v1, v0}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method
